package com.fundynamic.learnbydoing.designpatterns.statePattern.withPattern.factory;

import com.fundynamic.learnbydoing.designpatterns.statePattern.withPattern.domain.UnknownState;
import com.fundynamic.learnbydoing.designpatterns.statePattern.withPattern.domain.User;


public class UserFactory {

	public User createUser() {
		User user = new User();
		// in this case, default is creating the UnknownState
		// but within a DAO you might want to set the state by reading a
		// flag. This is the only 'switch' statement you will ever make
		// reading out the state as an 'enum' like and directly instantiate
		// the corresponding State Object.
		user.setRegistrationState(new UnknownState(user));
		return user;
	}
	
}
